home *** CD-ROM | disk | FTP | other *** search
- Path: airdmhor.gen.nz!not-for-mail
- From: gumboot@airdmhor.gen.nz (Simon Hosie)
- Newsgroups: comp.lang.c
- Subject: Non arithmetic integer type.
- Date: 17 Mar 1996 22:20:17 +1200
- Organization: Airdmhor : a couple of BBS's, a bunch of people, and a cat.
- Message-ID: <4igp11$83a@airdmhor.gen.nz>
- NNTP-Posting-Host: airdmhor.gen.nz
- X-Newsreader: TIN [version 1.2 PL2]
-
- I've been trying to create a data type that holds an int or intlike chunk
- of data that is incompatible with any other types (to generate errors if
- someone assumes that it's the same type as an int).. I've found that
-
- typedef struct { int Value; } TypeA;
- typedef struct { int ValueWithADifferentName; } TypeB;
-
- makes two compatible types; a variable of TypeA can be assigned to a
- variable of TypeB without any warnings.. but
-
- typedef struct { int Value; } TypeA;
- typedef struct { unsigned Value; } TypeB;
-
- is incompatible, which is what I want and it works.. but what if I want
- three or more incompatible types?
-